<%@ include file="/WEB-INF/include/base.jsp" %>
<%@ include file="/WEB-INF/include/base/standardObjects.jsp" %>
<%@ page isELIgnored="false" %>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title><bean:message key="title.application"/></title>			
		<link rel="stylesheet" type="text/css" href="./common/css/master.css"/>				
	</head>
	<body>
	<%@ include file="/WEB-INF/include/base/variables.jsp" %>
	<%
		User user = (User)session.getAttribute("user");											
		String[] sexes = {"Male", "Female"};
		String countryName= CountryListDao.getCountryName(user.getCountry());
	%>
	<c:set var="sexString" value="<%=sexes[user.getSex()] %>"/>
	<c:set var="userCountry" value="<%=countryName %>"/>	
	<table id="body" border="0">		
		<tr>
			<td id="content">
				<table class="c_table" width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>							
							<html:form action="/editAccount.do">				
								<table id="editDetails" class="standard">									
									<html:messages id="errors" message="true" property="heading">
									<tr>
										<td class="error" colspan="3" align="center">
											<div class="m_ul">
												<div class="m_ur">
													<div class="m_ll">
														<div class="m_lr">	
															<c:out value="${errors }"/>
														</div>
													</div>
												</div>
											</div>										
										</td>
									</tr>
									</html:messages>
									<html:messages id="messages" message="true" property="successMessage">
									<tr>
										<td class="error" colspan="3" align="center">
											<c:out value="${messages }"/>
										</td>
									</tr>
									</html:messages>
									<tr>				
										<td class="label"><bean:message key="label.firstName"/>, <bean:message key="label.lastName"/></td>
										<td class="data">											
											<html:text property="firstName" size="15" value="${user.firstName }"/>
											<html:text property="lastName" size="15" value="${user.lastName }"/></td>
										<td class="error">
											<html:messages id="errors" message="true" property="firstName">
												<c:out value="${errors }"/>
											</html:messages>
											<html:messages id="errors" message="true" property="lastName">
												<c:out value="${errors }"/>
											</html:messages>&nbsp;
										</td>
									</tr>					
									<tr>
										<td class="label"><bean:message key="label.emailAddress"/></td>
										<td class="data">
											<bean:write name="user" property="emailAddress"/>&nbsp;
											<html:hidden property="emailAddress" value="${user.emailAddress }"/>
											<html:hidden property="id" value="${user.id }"/>
										</td>
										<td class="error">
											<html:messages id="errors" message="true" property="emailAddress">
												<c:out value="${errors }"/>
											</html:messages>&nbsp;
										</td>
									</tr>
									<tr>
										<td class="label"><bean:message key="label.password"/>, <bean:message key="label.passwordConfirm"/></td>
										<td class="data">
											<html:password property="password" size="15" value="${user.password }"/>
											<html:password property="passwordConfirm" size="15" value="${user.password }"/>
										</td>
										<td class="error">											
											<html:messages id="errors" message="true" property="password">
												<c:out value="${errors }"/>
											</html:messages>
											<html:messages id="errors" message="true" property="passwordConfirm">
												<c:out value="${errors }"/>
											</html:messages>&nbsp;
										</td>
									</tr>
									<tr>
										<td class="label"><bean:message key="label.sex"/>, <bean:message key="label.age"/></td>
										<td class="data">																			
											<html:select property="sex" value="${user.sex + 1}">
												<html:option value="0">Select</html:option>
												<html:option value="1">Male</html:option>
												<html:option value="2">Female</html:option>
											</html:select>
											<html:select property="age" value="${user.age }">
												<html:option value="0">Select</html:option>
												<c:forEach var="i" begin="12" end="60">
													<html:option value="${i }"><c:out value="${i }"/></html:option>
												</c:forEach>
											</html:select>											
										</td>
										<td class="error">
											<html:messages id="errors" message="true" property="sex">
												<c:out value="${errors }"/>
											</html:messages>
											<html:messages id="errors" message="true" property="age">
												<c:out value="${errors }"/>
											</html:messages>&nbsp;
										</td>
									</tr>
									<tr>
										<td class="label"><bean:message key="label.country"/></td>
										<td class="data">
											<jsp:useBean id="list" scope="page" class="com.web.util.obj.CountryList"/>
											<html:select property="country" value="${user.country }">
												<html:option value="">Select country</html:option>
												<c:forEach var="country" items="${list }">
													<html:option value="${country.value }"><c:out value="${country.label }"/></html:option>
												</c:forEach>								
											</html:select>							
										</td>
										<td class="error">
											<html:messages id="errors" message="true" property="country">
												<c:out value="${errors }"/>
											</html:messages>&nbsp;
										</td>
									</tr>		
									<tr>					
										<td>&nbsp;</td>
										<td class="cmd">
											<html:submit value="Cancel"/>
											<html:reset value="Reset"/>
											<html:submit value="Submit"/>
										</td>
										<td>&nbsp;</td>
									</tr>									
								</table>
							</html:form>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</body>
</html>